Some functional units in a system can require allocation of a physically contiguous memory buffer. For example, some hardware requires a physically contiguous memory buffer at all times, for Direct Memory Access (DMA). Although there is even a functional unit equipped with hardware for processing a scatter/gather DMA function, hardware equipped with a low-cost DMA engine can very commonly require a physically contiguous memory.
Such hardware can include a camera, a video encoder/decoder (codec), and the like. In particular, the latest full High-Definition (HD) video frame has a resolution of about 2 Mega pixels or more, and a memory of about 6 Mega Byte (MB) is required to process the full HD video frame. These hardware modules are equipped with a simple DMA engine due to the high manufacturing cost, so they necessarily require a physically contiguous memory for their operation.
However, allocation of a physically contiguous memory may not be guaranteed at all times due to the nature of management of the memory used by an Operating System (OS). The OS divides a physical address space into small units of page frames, for management. This method has no problem in providing a logically contiguous memory space to the processes driven or enabled by the OS. However, in a system of a terminal which has been operating for a very long time, it is almost impossible to find a physically contiguous memory space of a predetermined size or more. In other words, driving of the functional unit may not be guaranteed depending on the fragmentation of a physical memory.
These problems can be fatal to electronic devices such as terminals, meaning that some features of a terminal may not be driven depending on whether the memory allocation is successful. These uncertainties are serious problems, because it must be guaranteed that the features of electronic devices can be driven at all times whenever the users want.
In addition, some functional units require allocation of a specific memory location, or for the functional units, areas of the memory can need to be arranged in a predetermined rule. Therefore, for the reduction of the manufacturing cost or the convenience of the development, hardware designers often reflect these limitations in the design. However, these limitations make the allocation of a physically contiguous memory more difficult.
In order to solve these and other problems, the conventional functional unit driver uses a way to separately reserve its required memory area at the initial driving of the OS. At the initial driving of the OS, a physically contiguous memory can be easily obtained, making it possible for a functional unit to reserve a memory area required for its operation, preventing the OS from using the reserved area. This method guarantees that the allocation of a physically contiguous memory is successful at all times, at the time a functional unit is driven. Therefore, the OS can use only the areas except for the memory area reserved by the functional unit driver, and the reserved area of the memory can be used only for the functional unit.
FIG. 1 illustrates an example physical memory including reserved areas and non-reserved areas. The memory in FIG. 1 has an area 101a reserved for a video codec unit, an area 101b reserved for a camera unit, and a non-reserved area 102 that the OS can dynamically allocate except the reserved areas 101a and 101b. 
Undesirably, however, the memory reservation method can cause a waste of the memory since the OS cannot use the reserved areas even when their associated functional units are not being driven. For example, if a ratio of the time during which the camera unit is activated to the total usage time of the device is 10% or less, the area reserved for the camera unit cannot be utilized at all for the remaining time of 90% or more during which the camera unit is not used, causing the waste of the memory.
In recent years, an embedded system uses a System on Chip (SoC) that is manufactured by integrating multiple functional units into one Central Processing Unit (CPU) chip as a single package. With the increasing types and number of functional units embedded in the SoC, such as a video codec, the amount of memory wasted due to the memory areas reserved for these embedded hardware functional units increases more and more, leading to a decrease in available memory that the OS can use. To compensate for these shortcomings, the product can be equipped with a high-capacity memory, leading to a rise in the cost.
In order to solve these issues, the present disclosure presents an approach, in which when a functional unit having a reserved memory area is not driven, the reserved area can be used as a non-reserved area, i.e., an available memory area that the OS can utilize.
If a functional unit assigned with a reserved memory area is driven while using the reserved area as a non-reserved area when the functional unit is not driven, the OS discards the data stored in the reserved area, thereby providing or returning the reserved area to the functional unit as its original purpose.
Discarding the data stored in the reserved area is commonly referred to as ‘paging migration’.
Advantageously, this memory management technique can utilize the area reserved for a functional unit that is in an idle state almost at all times, as a general purpose, thereby preventing the waste of memory and increasing the utilization of the memory resources, thus contributing to the improvement of the overall system performance due to the increase in available memory area.
Undesirably, however, the driving time of the functional unit can increase due to the burden of the page migration.
For example, if a memory area reserved for a camera unit is used as a general purpose, driving or execution of a camera application may be delayed than before. The recent camera unit consumes a memory of about tens of megabytes. Performing page migration on a memory space of tens of megabytes may cause a significant delay of the camera driving time.
The above information is presented as background information only to assist with an understanding of the present disclosure. No determination has been made, and no assertion is made, as to whether any of the above might be applicable as prior art with regard to the present disclosure.